<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/comm/header.jsp"%>
<div class="container">

    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title" id="aaa"data-toggle="collapse" data-target=".panel-body">
                查询条件
                <span class="caret pull-right" ></span>
            </h3>
        </div>
                    <div class="panel-body">
                        <form class="form-inline" id="queryForm">
                            <div class="form-group">
                                <label>用户名</label>
                                <input type="email" class="form-control" name="username">
                            </div>
                            <div class="form-group">
                                <label>角色</label>
                                <select id="sd" class="form-control" name="roleId">
                                    <option value="0">不限</option>
                                </select>
                </div>
                <div class="form-group">
                    <label>起始日期:</label>
                    <input type="date" name="startDate" class="form-control">
                </div>
                <div class="form-group">
                    <label>结束日期:</label>
                    <input type="date" name="endDate" class="form-control">
                </div>
                <button type="button" onclick="queryUser()" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i> 查询</button>
            </form>
        </div>
    </div>
    <div id="toolbar">
        <shiro:hasPermission name="user:add">
        <button class="btn btn-primary">添加用户</button>
        </shiro:hasPermission>
        <shiro:hasPermission name="user:grant">
        <button class="btn btn-success" onclick="grant()">用户授权</button>
        </shiro:hasPermission>
        <div style="display:none" id="ycTool">
            <shiro:hasPermission name="user:update">
                <button class="btn btn-warning edit"><i class="glyphicon glyphicon-edit "></i>修改用户
                </button>
            </shiro:hasPermission>
            <shiro:hasPermission name="user:del">
                <button class="btn btn-warning edit"><i class="glyphicon glyphicon-danger "></i>删除用户
                </button>
            </shiro:hasPermission>
        </div>
    </div>
    <table id="userTb"
           data-toggle="table"
           data-striped="true"
           data-url="sys/user/query"
           data-toolbar="#toolbar"
           data-pagination="true"
           data-side-pagination="server"
           data-page-size="4"
           data-page-list="[4,8,12]"
           data-height="350"
           <%--data-query-params="queryParams"--%>
            data-detail-view="true"
           data-detail-formatter="detailFormatter"
    >
        <thead>
        <tr>
            <th data-radio="true"></th>
            <th data-field="username">用户名</th>
            <th data-field="gender" data-formatter="fmtGender">性别</th>
            <th data-field="creationDate">创建日期</th>
            <th data-field="role" data-formatter="fmtRole">角色</th>
            <th data-formatter="actionFormatter" data-events="actionEvents">操作</th>
        </tr>
        </thead>
    </table>

    <div id="grant">
        <table  data-toggle="table"
                data-url="sys/role/list"
                data-height="300">
            <thead>
            <tr>
                <th data-radio="true"></th>
                <th data-field="roleName">角色代号</th>
                <th data-field="roleCode">角色名称</th>
            </tr>
            </thead>

        </table>
    </div>

</div>

<%@include file="/comm/footer.jsp"%>
<script src="static/scripts/user.js"></script>